<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<% String path = request.getContextPath(); request.setCharacterEncoding("UTF-8");
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">   
<head>
<base href="<%=basePath%>">
<title>台账查询</title>
<jsp:include page="/WEB-INF/jsp/common/common.jsp"></jsp:include>	
<link href="css/calendar.css"  rel="stylesheet" type="text/css" >
<link rel="stylesheet" href="<%=path%>/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="<%=path%>/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery.ztree.excheck-3.5.js"></script>
<script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
<style type="text/css">
.sub-title {
    background: none repeat scroll 0 0 #ffffff;
    font-size: 100%;
    font-weight: bold;
    height: 30px;
    line-height: 30px;
    text-indent: 10px;
    width: 100%;
}
</style>
	<script language="javascript" type="text/javascript">
		var defaultBranch;//保存默认机构的值
		$(document).ready(function() {
			isReadyIframe();
			
			loadPrivilegeBranchSelect();//加载机构下拉框
		});
		
		function isReadyIframe(){
			var iframe = $(window.parent.document).find("#iframe").length;
			if(iframe==0){
				window.location.href="<%=basePath%>index.jsp";
			}
		}
		
		//加载机构下拉框
		function loadPrivilegeBranchSelect(){
			$.ajax({
					url : "<%=path%>/standBookList/queryPrivilegeBranch?"+new Date().getTime(),
					type : 'POST',
					async : false,
					dataType:'json',
					success : function(result) {
						if(result){
							if($.validate(result))return;

							//接口下拉框对象
							var privilegeBranchSelect = document.getElementById("privilegeBranch");
							privilegeBranchSelect.length=0;
							
							var data = result.data;
							if(data.length > 0){
								defaultBranch = data[0].deptCode;
									
								for (var i = 0; i < data.length; i++) {
									var option = new Option();
									option.text = data[i].deptCname;
									option.title = data[i].deptCname;
									option.value = data[i].deptCode;
									
									privilegeBranchSelect.add(option);
								}
							}
						}
					}
				});
		 }
		
		//“重置”查询条件
		function  resetCriteria(){
			$('#downloadStandBookFileForm input[type!="button"]').val("");
			$('#downloadStandBookFileForm select[name!="privilegeBranch"]').val("");
			$("#privilegeBranch").val(defaultBranch);//机构置为默认机构
		}

		
		//点击“查询”
		function queryStandBook(pageIndex){
			if(pageIndex == null){
				pageIndex = 1;
			}
			if(pageIndex == -1){
				pageIndex = 1;
			}
			
			var asyncFlag = true;
			if(pageIndex == -1){
				asyncFlag = false;
			}
			
			var privilegeBranch = $.trim($("#privilegeBranch").val());//机构
			var polNo =$.trim($("#polNo").val());//保单号
			var sysFlag =$.trim($("#sysFlag").val());//归属系统
			var status =$.trim($("#status").val());//台账状态
			var bbrName = $.trim($("#bbrName").val());//被保险人姓名
			var beginDate=  $.trim($("#beginDate").val());//保单提交日期
			var endDate=  $.trim($("#endDate").val());//保单结束日期
			$.openLoading();
			$.ajax({
				url : "<%=path%>/standBookList/queryStandBookPageByCriteria",
				type : 'POST',
				async : asyncFlag,
				dataType:'json',
				data:{
					pageIndex:pageIndex,
					privilegeBranch:privilegeBranch,
					polNo:polNo,
					sysFlag:sysFlag,
					status:status,
					bbrName:bbrName,
					beginDate:beginDate,
					endDate:endDate,
				},
				success:function(page){
					$.closeLoading();	
					//业务处理	
					var fieldNames = "polno,sysFlag?[{'1':'人险'};{'2':'财险'};{'3':'新人险'};{'4':'车险'};{'5':'信保'}],amount,prem,beginDate,endDate,tbrName,bbrName,status?[{'1':'申请'};{'2':'已确认'};{'3':'已撤消'}]";
					var tableContent = creatTable1(fieldNames,page,null,null);																			
					var tableObj = $("#standBookTable");
					tableObj.find("tbody").remove();
					tableObj.append(tableContent);
					var strPage = creatChannelPage(pageIndex,6,page.maxPage,"57");
					var pageDIV = $("#standBookPageDiv");
					pageDIV[0].innerHTML="";
					pageDIV.append(strPage); 
					
				}
			});
		}
	</script>
	
	</head>
	<body>
 	 <div class="current">
           <table class="current_table_1">
             <tbody>
              	<tr class="f2">
	                <td><img src="./images/current_1.jpg"></td>
	                <td class="current_table_1_td">
	                  <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
	                  <span style=" color:#136bab; ">统计分析
	                  	<span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>台账查询
	                  </span>
                  	</td>
                 	<td><img src="./images/current_3.jpg"></td>
              	</tr>
           	 </tbody>
           </table>
     </div>
       
       <!--查询条件及结果表单 -->
        <table border="1" class="table_02" style="height:150px">
	  		<tr height="50px">
	  			<td colspan="2" align="center">
	  				<form method="post" id="downloadStandBookFileForm"> 
						<table border="0" style="margin: 12px auto;">
							<tr>
								<td style="padding-left:40px; border: 0;text-align: right" nowrap="nowrap">机&nbsp;&nbsp;&nbsp;构：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
								   <select class="search_select_1" name="privilegeBranch" id="privilegeBranch" onchange="clearBranchRelaField()" style="width: 206px"></select>
								</td>
								<td style="border: 0;text-align: right;" nowrap="nowrap">保单号：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
									<input name="polNo" id="polNo" class="input_text" style="width:130px;" size="25"/>
								</td>
								<td style="border: 0;text-align: right;" nowrap="nowrap">归属系统：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
								   <select class="search_select_1" name="sysFlag" id="sysFlag">
										<option value="">---请选择---</option>								   		
								   		<option value="1">人险</option>
								   		<option value="2">财险</option>
								   		<option value="3">新人险 </option>
								   		<option value="4">车险</option>
								   		<option value="5">信保</option>
								   </select>
								</td>
								<td style="border: 0;text-align: right;" nowrap="nowrap">台账状态：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
								   <select class="search_select_1" name="status" id="status">
										<option value="">---请选择---</option>								   		
								   		<option value="1">申请</option>
								   		<option value="2">已确认</option>
								   		<option value="3">已撤消</option>
								   </select>
								</td>
							</tr>
							<tr>
								<td style="border: 0;text-align: right;" nowrap="nowrap">被保人名称：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
									<input name="bbrName" id="bbrName" class="input_text" style="width:130px;" size="25"/>
								</td>
								<td style="border: 0;text-align: right;" nowrap="nowrap">起保日期：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
									 <input id="beginDate" name="beginDate" readonly="readonly" onclick="showCalendar('beginDate','y-mm-dd');"  class="input_time"/>
								</td>
								<td style="border: 0;text-align: right;" nowrap="nowrap">终保日期：</td>
								<td style="border: 0;text-align: left;padding-right: 70px">
									 <input id="endDate" name="endDate" readonly="readonly" onclick="showCalendar('endDate','y-mm-dd');"  class="input_time"/>
								</td>
							</tr>
							<tr>
								<td colspan="8" style="border: 0;padding-top: 5px;padding-right: 70px">
									<input type="button"  class="input_button_1"  value="查询"    onClick="queryStandBook()"/>
								   	<input type="button"  class="input_button_1"  value="重置"    onClick="resetCriteria()"/>
								</td>
							</tr>
						</table>	  				
				    </form>
				</td>
	  		</tr>
	  		<tr>
	  			<td valign="top">
		  			<div id="standBookDiv" style="width:98%;margin:5px" >
				  		<table class="table_02" id="standBookTable">
					  		<thead>
				               <tr>
				                  <th style="width:15%" nowrap="nowrap">保单号</th>
				                  <th style="width:8%" nowrap="nowrap">归属系统</th>
				                  <th style="width:8%" nowrap="nowrap">保额</th>
				                  <th style="width:8%" nowrap="nowrap">保费</th>
				                  <th style="width:8%" nowrap="nowrap">保险起期</th>
				                  <th style="width:5%" nowrap="nowrap">保险止期</th>
				                  <th style="width:9%" nowrap="nowrap">投保人名称</th>
				                  <th style="width:9%" nowrap="nowrap">被保人名称</th>
				                  <th style="width:9%" nowrap="nowrap">状态</th>
				              	</tr>
				              </thead>
			              <tbody>
						  </tbody>
			            </table>
		  				 <div id="standBookPageDiv"  class="page"></div>
		  			</div>
	  			</td>
	  		</tr>
	  	</table>
       
	</body>
</html>
